//
// File: lomb2.cpp
//
// MATLAB Coder version            : 5.4
// C/C++ source code generated on  : 21-Mar-2025 16:18:04
//

// Include Files
#include "lomb2.h"
#include "calc_TimeFreq_Lomb_types.h"
#include "rt_nonfinite.h"
#include "coder_array.h"

// Function Definitions
//
// Arguments    : coder::array<double, 1U> &in1
//                const coder::array<double, 1U> &in2
//                const coder::array<double, 1U> &in3
//                int in4
//                int in5
// Return Type  : void
//
void binary_expand_op(coder::array<double, 1U> &in1,
                      const coder::array<double, 1U> &in2,
                      const coder::array<double, 1U> &in3, int in4, int in5)
{
  int b_in5;
  int loop_ub;
  int stride_1_0;
  if ((in5 - in4) + 1 == 1) {
    b_in5 = in2.size(0);
  } else {
    b_in5 = (in5 - in4) + 1;
  }
  in1.set_size(b_in5);
  b_in5 = (in2.size(0) != 1);
  stride_1_0 = ((in5 - in4) + 1 != 1);
  if ((in5 - in4) + 1 == 1) {
    loop_ub = in2.size(0);
  } else {
    loop_ub = (in5 - in4) + 1;
  }
  for (int i{0}; i < loop_ub; i++) {
    in1[i] = in2[i * b_in5] * in3[in4 + i * stride_1_0];
  }
}

//
// Arguments    : struct0_T *in1
//                const coder::array<double, 1U> &in2
// Return Type  : void
//
void binary_expand_op(struct0_T *in1, const coder::array<double, 1U> &in2)
{
  coder::array<double, 1U> b_in2;
  int i;
  int loop_ub;
  int stride_0_0;
  int stride_1_0;
  if (in1->global_PSD.size(0) == 1) {
    i = in2.size(0);
  } else {
    i = in1->global_PSD.size(0);
  }
  b_in2.set_size(i);
  stride_0_0 = (in2.size(0) != 1);
  stride_1_0 = (in1->global_PSD.size(0) != 1);
  if (in1->global_PSD.size(0) == 1) {
    loop_ub = in2.size(0);
  } else {
    loop_ub = in1->global_PSD.size(0);
  }
  for (i = 0; i < loop_ub; i++) {
    b_in2[i] = in2[i * stride_0_0] * in1->global_PSD[i * stride_1_0];
  }
  in1->global_PSD.set_size(b_in2.size(0));
  loop_ub = b_in2.size(0);
  for (i = 0; i < loop_ub; i++) {
    in1->global_PSD[i] = b_in2[i];
  }
}

//
// Arguments    : coder::array<double, 1U> &in1
//                const coder::array<double, 1U> &in2
// Return Type  : void
//
void times(coder::array<double, 1U> &in1, const coder::array<double, 1U> &in2)
{
  coder::array<double, 1U> b_in2;
  int i;
  int loop_ub;
  int stride_0_0;
  int stride_1_0;
  if (in1.size(0) == 1) {
    i = in2.size(0);
  } else {
    i = in1.size(0);
  }
  b_in2.set_size(i);
  stride_0_0 = (in2.size(0) != 1);
  stride_1_0 = (in1.size(0) != 1);
  if (in1.size(0) == 1) {
    loop_ub = in2.size(0);
  } else {
    loop_ub = in1.size(0);
  }
  for (i = 0; i < loop_ub; i++) {
    b_in2[i] = in2[i * stride_0_0] * in1[i * stride_1_0];
  }
  in1.set_size(b_in2.size(0));
  loop_ub = b_in2.size(0);
  for (i = 0; i < loop_ub; i++) {
    in1[i] = b_in2[i];
  }
}

//
// File trailer for lomb2.cpp
//
// [EOF]
//
